﻿//-----------------------------------------------------------------------
// <copyright file="DateTimeExtensions.cs" company="SLWY Enterprises">
// * Copyright (C) 2017 四川商旅无忧科技有限公司 版权所有。
// * version : 1.0
// * author  : qinchaoyue
// * FileName: DateTimeExtensions.cs
// * history : created by qinchaoyue 2017-11-27 05:19:10
// </copyright>
//-----------------------------------------------------------------------

using System;

namespace Slwy.Utility.Extensions
{
    /// <summary>
    /// 时间类扩展
    /// </summary>
    public static class DateTimeExtensions
    {
        /// <summary>
        /// 获取一个时间与当前时间之间的差 单位毫秒
        /// </summary>
        /// <param name="beginDateTime">开始时间</param>
        /// <returns>相距毫秒数</returns>
        public static long GetDifference(this DateTime beginDateTime)
        {
            return (long)(DateTime.Now - beginDateTime).TotalMilliseconds;
        }
    }
}
